<template>
  <!-- 家庭病床工作逐日登记表 -->
  <div>
    <h1>家庭病床工作逐日登记表</h1>
    <h3>{{startDate}} 年 ~ {{endDate}} 年</h3>
    <h2>医院名称：湖北省中医院</h2>
    <el-table :data="tableData" stripe border style="width: 100%">
      <el-table-column prop="tjm7mc" label="时期" align="center" width></el-table-column>
      <el-table-column prop="tjm7033" label="总诊疗人次数" align="center" width></el-table-column>
      <el-table-column prop="tjm7022" label="撤床病人诊疗人次数" align="center" width></el-table-column>
      <el-table-column label="撤床病人数" align="center" width>
        <el-table-column prop="tjm7025" label="总计" align="center" width></el-table-column>
        <el-table-column prop="tjm7026" label="治愈" align="center" width></el-table-column>
        <el-table-column prop="tjm7027" label="好转" align="center" width></el-table-column>
        <el-table-column prop="tjm7028" label="未愈" align="center" width></el-table-column>
        <el-table-column prop="tjm7029" label="死亡" align="center" width></el-table-column>
      </el-table-column>
      <el-table-column prop="tjm7023" label="上期末实有家床数" align="center" width></el-table-column>
      <el-table-column prop="tjm7024" label="本期新增家床数" align="center" width></el-table-column>
      <el-table-column prop="tjm70301" label="本期末实有病床数" align="center" width></el-table-column>
      <el-table-column prop="tjm7031" label="家床累计开设日数" align="center" width></el-table-column>
      <el-table-column prop="tjm7032" label="本期总撤床日数" align="center" width></el-table-column>
    </el-table>
  </div>
</template>

<script>
import { familyBedLedger } from "@/api";
import { showOkMsg, showErrorMsg } from "@/utils/index.js";

export default {
  data() {
    return {
      tableData: [],
      startDate: "",
      endDate: ""
    };
  },
  created() {
    this.getTableList();
  },
  props: ["dateList"],
  methods: {
    getTableList() {
      if (this.dateList.dateBegin && this.dateList.dateEnd) {
        familyBedLedger({
          kb: "0000",
          startTime: this.dateList.dateBegin,
          endTime: this.dateList.dateEnd
        }).then(res => {
          if (res.code === 0) {
            this.startDate = this.dateList.dateBegin;
            this.endDate = this.dateList.dateEnd;
            this.tableData = res.data;
            showOkMsg(res.msg);
          }
        });
      } else {
        showErrorMsg("请选择开始和结束日期");
      }
    }
  }
};
</script>

<style scoped>
h1 {
  font-size: 24px;
  text-align: center;
  padding: 23px 0;
}
h3 {
  text-align: center;
  padding-bottom: 20px;
}
h2 {
  padding: 4px 0;
  display: flex;
  justify-content: space-between;
}
</style>